﻿using log4net;
using Quartz;
using quartz_service.Entities;
using quartz_service.Tools;

namespace quartz_service.JobTasks
{
    public class QueryJob : IJob
    {
        private static readonly ILog logger = LogManager.GetLogger(typeof(QueryJob));

        public async Task Execute(IJobExecutionContext context)
        {
            await Task.Run(async () =>
            {
                try
                {
                    var list = await SqlSugarHelper.Db.Queryable<Add_Log>().ToListAsync();
                    logger.Info($"获取数据成功, 共 {list.Count} 条");
                }
                catch (Exception ex)
                {
                    logger.Error("获取数据失败, 异常为: " + ex.ToString());
                }
            });
        }
    }
}
